﻿using Bricks.Data;
using NHibernate;

namespace Bricks.NHibernate.Data
{

    /// <summary>
    /// 
    /// </summary>
    public class QueryOverFacadeFactory : SessionFacadeFactoryBase
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sessionFactory"></param>
        public QueryOverFacadeFactory(ISessionFactory sessionFactory) :
            base(sessionFactory)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override IContextFacade Create()
        {
            return Execute<IContextFacade>(sessionFactory => new QueryOverFacade(sessionFactory.OpenSession()));
        }
    }
}